package com.xxx.store.controller;

import com.xxx.store.entity.District;
import com.xxx.store.service.DistrictService;
import com.xxx.store.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/districts")
@RestController
public class DistrictController extends BaseController{
    @Autowired
    private DistrictService districtService;
    @RequestMapping({"/",""})
    public JsonResult<List<District>> getDistricts(String parent){
        List<District> list = districtService.getByParent(parent);
        return new JsonResult<>(OK,list);
    }
}
